-
-
Notifications
You must be signed in to change notification settings - Fork 225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implemented transform-regexp-constructors plugin #196
Conversation
4c92a80
to
5a32d2a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great!
I just think that we might miss out on a lot of cases where strings are concatenated together — new RegExp('foo' + 'bar')
or where RegExp
receieves an identifer (new RegExp(RE_FOO_BAR)
) or a combination of two (new RegExp(reSmth + '$')
).
Can we try to account for these cases too?
5a32d2a
to
4ea9597
Compare
Updated. Also, for RegExp constructors with 0 arguments, this would currently throw at |
Yeah, let's definitely add a check for 0 arguments. It should transform to |
4ea9597
to
4d58818
Compare
Updated to gracefully handle empty RegExp constructions. |
Changes RegExp constructors into literals.
4d58818
to
5d82d65
Compare
Thanks! |
@hzoo @loganfsmyth @danez do we want to also update babili preset? |
yeah if want to add it now - we'll need the package.json for this package + adding it to the preset package.json if we do |
@shinew Let's do it. That way we could also see the impact of this plugin on performance with our benchmark. |
Changes RegExp constructors to literals.